package com.sumer.psychology.common.domain.model;

import org.apache.commons.lang3.StringUtils;

/**
 * 改变user信息
 * <p/>
 * Created by twer on 15/3/30.
 */
public class ChangeUserProfileCommand {
    private String identity;
    private String name;
    private String gender;
    private String phone;
    private String qq;
    private String email;

    public ChangeUserProfileCommand(String identity, String name, String gender, String phone, String qq, String email) {
        this.identity = identity;
        this.name = name;
        this.gender = gender;
        this.phone = phone;
        this.qq = qq;
        this.email = email;
    }

    public String identity() {
        return identity;
    }

    public String name() {
        return name;
    }

    public String gender() {
        return gender;
    }

    public String phone() {
        return phone;
    }

    public String qq() {
        return qq;
    }

    public String email() {
        return email;
    }

    public String toParameters() {
        String parameters = "";
        if (StringUtils.isNotBlank(name)) {
            parameters += "&name=" + name;
        }
        if (StringUtils.isNotBlank(gender())) {
            parameters += "&sex=" + gender();
        }
        if (StringUtils.isNotBlank(phone())) {
            parameters += "&tel=" + phone();
        }
        if (StringUtils.isNotBlank(qq())) {
            parameters += "&qq=" + qq();
        }
        if (StringUtils.isNotBlank(email())) {
            parameters += "&email=" + email();
        }
        return parameters;
    }
}
